package cn.lingyangwl.agile.system.model.rqrs.article;

import cn.lingyangwl.framework.tool.core.exception.BizException;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @author shenguangyang
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ArticleGetReq {
    @ApiModelProperty(value = "文章标识")
    private String code;

    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "是否从管理场景租户查询")
    private Boolean isFormSceneTenant = Boolean.FALSE;

    public void validation() {
        if (StringUtils.isEmpty(code) && Objects.isNull(id)) {
            throw new BizException("标识和主键不能同时为空");
        }
    }
}
